<template>
    <pageTabelLayout>
        <template #pageHeader>
            <div class="search-form" v-if="headerShow">
                <a-form size="mini" :model="pageData" layout="inline">
                    <a-form-item label="仓库类型" :rules="[{ required: true }]">
                        <a-select popup-container="html"  :style="{ width: '10rem' }" @change="companyChange" v-model="searchData.whTypeName"
                            allow-clear>
                            <a-option v-for="item in whTypeList" :value="item.typeName">
                                {{ item.typeName }}
                            </a-option>
                        </a-select>
                    </a-form-item>
                    <a-form-item label="选择公司" :rules="[{ required: true }]">
                        <a-select popup-container="html"  :style="{ width: '15rem' }" @change="companyChange" v-model="searchData.firmId"
                            allow-clear>
                            <a-option v-for="item in companyList" :value="item.id">
                                {{ item.typeName }}{{ item.typeName == "" ? "" : "-" }}{{ item.firmName }}
                            </a-option>
                        </a-select>
                    </a-form-item>
                    <a-form-item label="仓库" :rules="[{ required: true }]">
                        <a-select popup-container="html"  :style="{ width: '10rem' }" v-model="searchData.wh" allow-clear
                            @change="selectChange">
                            <a-option v-for="item in whList" :value="item.id">
                                {{ item.warehouseName }}
                            </a-option>
                        </a-select>
                    </a-form-item>
                </a-form>
            </div>
            <div class="my-divisders">
                <a-divider orientation="center">
                    <icon-double-up v-if="headerShow" @click="headerShow = false" :strokeWidth="2" :size="18" />
                    <icon-double-down v-else @click="headerShow = true" :strokeWidth="2" :size="18" />
                </a-divider>
            </div>
            <div class="my-tool-bar">
                <Toolbar v-if="isIDs == 1" :items="['查询', '新增', '创建下拉框', '删除']" @add="addHandler" @del="deleteHandler"
                    @select="selectHandler" @cjxlk="cjxlks">
                </Toolbar>
                <Toolbar v-else :items="['查询', '删除']" @del="deleteHandler" @select="selectHandler">
                </Toolbar>
            </div>
        </template>
        <template #pageTabel>
            <a-tabs   :lazy-load="true" :justify="true" @change="tabsChange">
                <a-tab-pane :key="1" title="仓库自定义属性">
                    <a-table style="height:100%" size="mini" :scrollbar="scrollbar" sticky-header
                        @page-change="pagination.change" stripe :bordered="true" :columns="tableColumns"
                        :row-selection="{ showCheckedAll: true, width: 50, onlyCurrent: true }"
                        v-model:selected-keys="selectedRowKeys" :loading="table.tableLoading" :data="table.dataList"
                        :pagination="false" :rowKey="rowKey">
                        <template #action="{ record }">

                        </template>
                    </a-table>
                </a-tab-pane>
                <a-tab-pane :key="2" title="仓库下拉框自定义属性">
                    <a-table style="height:100%" size="mini" :scrollbar="scrollbar" sticky-header
                        @page-change="paginations.change" stripe :bordered="true" :columns="tableColumns1"
                        :row-selection="{ showCheckedAll: true, width: 50, onlyCurrent: true }"
                        v-model:selected-keys="selectedRowKeys1" :loading="table1.tableLoading" :data="table1.dataList"
                        :pagination="false" rowKey="ls">
                        <template #action="{ record }">

                        </template>
                    </a-table>
                </a-tab-pane>
            </a-tabs>
        </template>
        <paginationCopys v-if="isIDs == 1" :total="pagination.total" show-total show-jumper show-page-size
            :page-size="pagination.pageSize" :current="pagination.page" @change="PageSize" @page-size-change="change1"
            style="justify-content: center" />
        <paginationCopys v-else :total="paginations.total" show-total show-jumper show-page-size
            :page-size="paginations.pageSize" :current="paginations.page" @change="PageSize" @page-size-change="change1"
            style="justify-content: center" />
        <a-drawer ok-text='保存' cancel-text='关闭' :drawer-style="{ 'zIndex': 9999 }" :mask-closable="false" :width="400"
            :visible="pageData.showAdd" @ok="sideOk" @cancel="pageData.showAdd = false">
            <template #title>
                {{ pageData.sideTitle }}
            </template>
            <div>
                <a-form ref="formRef" layout="vertical" :model="dataForm">
                    <a-form-item label="序号" field="serialNo" :rules="[{ required: true, message: '序号必填' }]"
                        :validate-trigger="['blur', 'change']">
                        <a-input-number v-model="dataForm.serialNo" :min="1"></a-input-number>
                    </a-form-item>
                    <a-form-item label="字段名称" field="fieldId" :rules="[{ required: true, message: '字段名称必填' }]"
                        :validate-trigger="['blur', 'change']">
                        <a-select popup-container="html"  :loading="loading" @focus="focusSel" @search="handleSearch"
                            @change="fieldNameChange($event)" v-model="dataForm.fieldId" :filter-option="false"
                            allow-search allow-clear>
                            <a-option v-for="item in pageData.fieldNameList" :value="item.id">{{ item.chineseName }}
                            </a-option>
                        </a-select>
                    </a-form-item>
                    <a-form-item label="字段英文名" field="valueType">
                        <a-input v-model="dataForm.englishName" disabled></a-input>
                    </a-form-item>
                    <a-form-item label="字段默认值" field="defaultValue">
                        <a-input v-model="dataForm.defaultValue"></a-input>
                    </a-form-item>
                    <a-form-item label="是否为查询条件" field="fieldName">
                        <a-select popup-container="html"  v-model="dataForm.selectState">
                            <a-option :value="1">是</a-option>
                            <a-option :value="0">否</a-option>
                        </a-select>
                    </a-form-item>
                    <a-form-item label="是否必填" field="mustState">
                        <a-select popup-container="html"  v-model="dataForm.mustState">
                            <a-option :value="1">是</a-option>
                            <a-option :value="0">否</a-option>
                        </a-select>
                    </a-form-item>
                    <a-form-item label="选择展示类型" field="showState" :rules="[{ required: true, message: '展示类型必选' }]"
                        :validate-trigger="['blur', 'change']">
                        <a-select popup-container="html"  v-model="dataForm.showState" multiple>
                            <a-option :value="0">库存</a-option>
                            <a-option :value="1">入库单</a-option>
                            <a-option :value="2">出库单</a-option>
                            <a-option :value="3">转仓单</a-option>
                            <a-option :value="4">退货单</a-option>
                        </a-select>
                    </a-form-item>
                    <a-form-item label="值类型" field="valueType">
                        <a-select popup-container="html"  v-model="dataForm.valueType" disabled>
                            <a-option :value="0">字符</a-option>
                            <a-option :value="1">数字</a-option>
                            <a-option :value="2">小数</a-option>
                        </a-select>
                    </a-form-item>
                    <a-form-item label="小数点个数" field="valueTypeNum">
                        <a-input v-model="dataForm.valueTypeNum" disabled />
                    </a-form-item>

                </a-form>
            </div>
        </a-drawer>
        <a-modal v-model:visible="visible" width="650px" @ok="handleOk" @cancel="handleCancel" :mask-closable="false">
            <template #title>
                创建下拉框
            </template>
            <div id="isyou">
                <span>类型：&nbsp;&nbsp;</span>
                <a-select popup-container="html"  :style="{ width: '320px' }" v-model="bm.bms2" allow-clear>
                    <a-option>入库</a-option>
                    <a-option>出库</a-option>
                    <a-option>转仓</a-option>
                    <a-option>退货</a-option>
                </a-select>
                <br />
                <span>表名：</span>
                <a-input :style="{ width: '320px', margin: '10px' }" v-model="bm.bms1" placeholder="" allow-clear>
                </a-input>
                <br />
                <a-checkbox-group @change="changes1" :default-value="changeIds">
                    <a-space direction="vertical" fill>
                        <a-checkbox v-for="item in dataListArray1" :value="item.id">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <a-input v-model="item['s1']" :style="{ width: '320px' }" allow-clear>
                                <template #prepend>
                                    {{ item.chineseName }}
                                </template>
                            </a-input>
                        </a-checkbox>
                    </a-space>
                </a-checkbox-group>
                <br />
                <a-button :style="{ margin: '10px' }" type="primary" @click="tjTj">添加条件</a-button>
                <br />
                <a-space direction="vertical">
                    <div v-for="items in tjIsDatasType">
                        <a-space>
                            <a-select popup-container="html"  :style="{ width: '160px' }" v-model="items.extendField" allow-clear
                                placeholder="">
                                <a-option v-for="item in tjType" :value="item.extendField">{{ item.fieldName }}
                                </a-option>
                            </a-select>
                            -
                            <a-input placeholder="" :style="{ width: '100px' }" allow-clear
                                v-model="items.tbField"></a-input>
                            -
                            <a-input placeholder="" :style="{ width: '100px' }" allow-clear
                                v-model="items.fieldValue"></a-input>
                            <a-button type="outline" @click="deletTj(items.index)">
                                <template #icon>
                                    <icon-delete />
                                </template>
                                删除
                            </a-button>
                        </a-space>
                    </div>
                </a-space>
            </div>
        </a-modal>
    </pageTabelLayout>
</template>

<script lang="ts">
import { post, get } from "@/api/http";
import {
    useTable,
    useRowKey,
    useTableColumn,
    usePagination,
    useRowSelection,
} from "@/hooks/table";

import { ref, reactive, onMounted, watch } from "vue";
import Toolbar from "@/components/Toolbar.vue";
import { Form, Message, Modal, Pagination } from "@arco-design/web-vue";
import { FormInstance } from "@arco-design/web-vue/es/form";
import emitter from "@/hooks/useEventBus";


import WHStore from '@/store/modules/wh'
import WHService from "@/service/wh";


interface whTypeField {
    id: number | string | undefined,
    serialNo: number,
    warehouseId: number,
    fieldId: number | string | undefined,
    mustState: number,
    defaultValue: string,
    selectState: number,
    englishName: string,
    valueType: number,
    valueTypeNum: number,
    showState: any,
}


export default {
    name: "CustomPropList",
    setup() {

        const searchData = reactive<{
            whTypeName: string,
            firmId: any,
            wh: string,
        }>({
            whTypeName: '',
            firmId: '',
            wh: '',

        })
        const whStore = WHStore()
        whStore.getWhTypeList()
        //查询
        const scrollbar = ref(true)

        function PageSize(val: any) {
            if (isIDs.value == 1) {
                pagination.page = val
                doRefresh();
            } else {
                paginations.page = val
                doRefreshs();
            }
        }

        function change1(val: any) {
            if (isIDs.value == 1) {
                pagination.pageSize = val
                doRefresh();
            } else {
                paginations.pageSize = val
                doRefreshs();
            }
        }

        function doRefresh() {
            pageData.pageLoading = true

            post({
                url: "wms/warehouseBindField/getFieldPageInfo",
                data: {
                    page: pagination.page,
                    size: pagination.pageSize,
                    deleteState: 0,
                    warehouseId: searchData.wh
                },
            })
                .then(({ data, code }: any) => {
                    if (code === 200) {
                        table.handleSuccess(data.list);
                        pagination.setTotalSize(data.total);
                        tableList1 = data.list;

                    }
                })
                .catch(console.log).finally(() => {
                    pageData.pageLoading = false
                })
        }

        const { selectedRowKeys, onSelectionChange } = useRowSelection();
        const selectedRowKeys1 = ref([])
        const pagination = usePagination(doRefresh);
        const paginations = usePagination(doRefreshs);
        const table = useTable();
        const table1 = useTable();
        const rowKey = useRowKey("id");
        const tableColumns = useTableColumn([
            {
                title: "序号",
                key: "serialNo",
                dataIndex: "serialNo",
                width: 150
            },
            {
                title: "字段中文名称",
                key: "chineseName",
                dataIndex: "chineseName",
                width: 150
            },
            {
                title: "字段英文名称",
                key: "englishName",
                dataIndex: "englishName",
                width: 150
            }, {
                title: "值类型",
                key: "valueType",
                dataIndex: "valueType",
                width: 150
            }, {
                title: "小数点个数",
                key: "valueTypeNum",
                dataIndex: "valueTypeNum",
                width: 150
            }, {
                title: "默认值",
                key: "defaultValue",
                dataIndex: "defaultValue",
                width: 150
            },
            {
                title: "是否必填",
                key: "mustState",
                dataIndex: "mustState",
                width: 150
            },
            {
                title: "是否为查询条件",
                key: "selectState",
                dataIndex: "selectState",
                width: 150
            }
        ]);

        const tableColumns1: any[] = [

            {
                title: "流水号",
                key: "ls",
                dataIndex: "ls",
                width: 150
            },
            {
                title: "类型",
                key: "type",
                dataIndex: "type",
                width: 150
            },
            {
                title: "仓库字段名称",
                key: "fieldStr",
                dataIndex: "fieldStr",
                width: 150
            },
            {
                title: "表名",
                key: "tbName",
                dataIndex: "tbName",
                width: 150
            },
            {
                title: "表字段",
                key: "tbFieldStr",
                dataIndex: "tbFieldStr",
                width: 150
            }
        ]
        const scroll = {
            x: 2000,
            y: 200
        };
        const tablediv = ref(null)
        const pageData = reactive<{
            showAdd: boolean
            sideTitle: string
            dropDownData: any
            pageLoading: boolean,
            theight: number,
            rHeight: number | undefined,
            fieldNameList: []
        }>({
            showAdd: false,
            sideTitle: "新增仓库自定义字段",
            dropDownData: "",
            pageLoading: false,
            theight: 0,
            rHeight: 0,
            fieldNameList: []
        });
        //下拉框得到焦点
        const focusSel = () => {
            selCxAll("")
        }
        //下拉数据
        const loading = ref(false);
        const handleSearch = (value: any) => {
            if (value) {
                loading.value = true;
                selCxAll(value);
                loading.value = false;
            }
        };

        //下拉框查询
        function selCxAll(val: any) {
            post({
                url: "wms/fieldBank/getFieldBankPage",
                data: {
                    chineseName: val,
                    deleteState: 0,
                    page: 1,
                    size: 30
                }
            }).then(({ data, code }: any) => {
                if (code === 200) {
                    pageData.fieldNameList = data.list;
                }
            });
        }

        onMounted(() => {
        });

        //查询
        const selectHandler = () => {
            if (searchData.whTypeName == '' || searchData.wh == '' || searchData.firmId == '') {
                Message.warning('请先选择仓库类型或选择公司或仓库')
                return;
            }
            if (isIDs.value == 1) {
                doRefresh();
            } else if (isIDs.value == 2) {
                doRefreshs();
            }
        }
        const queryData = reactive({
            clothType: "",
        });
        const addHandler = () => {
            if (searchData.whTypeName == '' || searchData.wh == '' || searchData.firmId == '') {
                Message.warning('请先选择仓库类型或选择公司或仓库')
                return;
            }
            dataForm.id = '';
            dataForm.serialNo = 1;
            dataForm.fieldId = '';
            dataForm.selectState = 0;
            dataForm.mustState = 0;
            dataForm.englishName = "";
            dataForm.valueType = 0;
            dataForm.valueTypeNum = 0;
            dataForm.showState = [];
            pageData.showAdd = true;
            pageData.sideTitle = "新增仓库自定义字段";
        };
        const dataForm = reactive<whTypeField>({
            "id": '',
            "serialNo": 1,
            "warehouseId": 0,
            "fieldId": '',
            "mustState": 0,
            "defaultValue": "",
            "selectState": 0,
            "englishName": "",
            "valueType": 1,
            "valueTypeNum": 0,
            "showState": []
        });
        const formRef = ref<FormInstance>();
        const sideOk = () => {
            formRef.value?.validate().then((err) => {
                if (!err) {
                    if (dataForm.showState.length <= 0) {
                        Message.warning("请选择展示类型");
                        return;
                    }
                    var info = {};
                    info["id"] = dataForm.id;
                    info["serialNo"] = dataForm.serialNo;
                    info["warehouseId"] = searchData.wh;
                    info["fieldId"] = dataForm.fieldId;
                    info["mustState"] = dataForm.mustState;
                    info["defaultValue"] = dataForm.defaultValue;
                    info["selectState"] = dataForm.selectState;
                    if (pageData.sideTitle === "新增仓库自定义字段") {
                        info["id"] = undefined;
                        post({
                            url: "wms/warehouseBindField/insert",
                            data: {
                                info: info,
                                showList: dataForm.showState
                            },
                        }).then((res: any) => {
                            if (res.code === 200) {
                                formRef.value?.resetFields();

                                pageData.showAdd = false;

                                Message.success({
                                    content: "新增成功",
                                    duration: 5000,
                                });
                                doRefresh();
                            } else {
                                Message.error({
                                    content: res.message,
                                    duration: 5000,
                                });
                            }

                        });
                    } else {
                        post({
                            url: "product/mercery/update",
                            data: [dataForm],
                        }).then((res: any) => {
                            if (res.code === 200) {
                                formRef.value?.resetFields();
                                pageData.showAdd = false;

                                Message.success({
                                    content: "修改成功",
                                    duration: 5000,
                                });
                                doRefresh();
                            } else {
                                Message.error({
                                    content: res.message,
                                    duration: 5000,
                                });
                            }

                        });
                    }
                }
            });
        };
        const deleteHandler = () => {
            if (isIDs.value == 1) {
                if (selectedRowKeys.value.length === 0) {
                    return;
                }
                Modal.confirm({
                    title: "系统提示",
                    content: "确认删除选中的数据?",
                    onOk() {
                        post({
                            url: "wms/warehouseBindField/delete",
                            data: selectedRowKeys.value,
                        }).then(({ code, data, message }: any) => {
                            if (code === 200) {
                                Message.success({
                                    content: "删除成功",
                                    duration: 5000,
                                });

                                pagination.page = 1
                                doRefresh();

                            } else {
                                Message.error({
                                    content: message,
                                    duration: 5000,
                                });
                            }

                        });
                    },
                });
            } else if (isIDs.value == 2) {
                if (selectedRowKeys1.value.length === 0) {
                    return;
                }
                Modal.confirm({
                    title: "系统提示",
                    content: "确认删除选中的数据?",
                    onOk() {
                        post({
                            url: "wms/warehousetypeDrop/delete",
                            data: selectedRowKeys1.value,
                        }).then(({ code, data }: any) => {
                            if (code === 200) {
                                Message.success({
                                    content: "删除成功",
                                    duration: 5000,
                                });

                                paginations.page = 1
                                doRefreshs();

                            } else {
                                Message.error({
                                    content: "删除失败",
                                    duration: 5000,
                                });
                            }

                        });
                    },
                });
            }
        };
        const editHandler = (record: whTypeField) => {
            dataForm.id = record.id
            dataForm.serialNo = record.serialNo

            pageData.showAdd = true;
            pageData.sideTitle = "修改仓库自定义字段";
        };

        //input离开焦点 将小写转大写

        const headerShow = ref<boolean>(true)
        let isIDs: any = ref(1);
        let tableList1 = ref([]);
        let tableList2 = ref([]);
        const tabsChange = (val: any) => {
            isIDs.value = val
            if (isIDs.value == 1) {
                table.handleSuccess(tableList1)
            } else {
                table1.handleSuccess(tableList2)
            }
        };

        function doRefreshs() {
            pageData.pageLoading = true
            post({
                url: "wms/warehousetypeDrop/getPage",
                data: {
                    page: paginations.page,
                    size: paginations.pageSize,
                    deleteState: 0,
                    warehouseId: searchData.wh
                },
            })
                .then(({ data, code }: any) => {
                    if (code === 200) {
                        table1.handleSuccess(data.list);
                        paginations.setTotalSize(data.total);
                        tableList2 = data.list;
                    }
                })
                .catch(console.log).finally(() => {
                    pageData.pageLoading = false
                })
        }

        const dataListArray1: any = ref([])

        const cjxlks = () => {
            if (selectedRowKeys.value.length == 0) {
                Message.error('请先勾选数据')
                return
            }
            let isArray: any = []
            selectedRowKeys.value.forEach((items: any) => {
                table.dataList.forEach((item: any) => {
                    if (items == item.id) {
                        isArray.push(item)
                    }
                })
            })
            dataListArray1.value = isArray
            console.log(dataListArray1.value)
            visible.value = true
        }
        const visible = ref(false)
        const handleOk = async () => {
            const inforType = dataListArray1.value.every((item: any) => {
                return item.hasOwnProperty("s1") && item.hasOwnProperty("dropState")
            })

            if (!inforType) {
                Message.error('参数有误')
                return
            }
            let type: any;
            if (bm.bms2 == '入库') {
                type = 1
            }
            if (bm.bms2 == '出库') {
                type = 2
            }
            if (bm.bms2 == '转仓') {
                type = 3
            }
            if (bm.bms2 == '退货') {
                type = 4
            }

            let infos: any = []
            dataListArray1.value.forEach((item: any) => {
                infos.push({
                    type: type,
                    wID: item.id,
                    wName: item.chineseName,
                    tbName: bm.bms1,
                    tbField: item.s1,
                    dropState: item.dropState,
                    warehouseId: searchData.wh,
                    wField: item.englishName,
                })
            })
            const res: any = await post(
                {
                    url: 'wms/warehousetypeDrop/insert',
                    data: {
                        info: infos,
                        conditions: tjIsDatasType.value
                    }
                }
            )
            if (res.code == 200) {
                for (let item in bm) {
                    bm[item] = ''
                }
                changeIds.value = []
                dataListArray1.value = []
                tjIsDatasType.value = []
                selectedRowKeys.value = []
                Message.success('添加成功')
            } else {
                changeIds.value = []
                dataListArray1.value = []
                tjIsDatasType.value = []
                selectedRowKeys.value = []
                Message.error(res.message)
            }
        }
        const handleCancel = () => {
            for (let item in bm) {
                bm[item] = ''
            }
            selectedRowKeys.value = []
            dataListArray1.value = []
            tjIsDatasType.value = []

        }
        const changeIds: any = ref([])
        const changes1 = (val: any) => {
           
            dataListArray1.value.forEach((item: any) => {
                if (val.includes(item.id)) {
                    item['dropState'] = 1
                } else {
                    item['dropState'] = 0
                }
                
            })
        }
        const bm: any = reactive({
            bms1: '',
            bms2: '',
            bms3: ''
        })
        const tjType: any = ref([])

        let tjIsDatasType: any = ref([])
        let indexs = 1;
        const tjTj = () => {
            if (bm.bms2 == '') {
                Message.error('请先选择类型')
                return
            }
            tjIsDatasType.value.push({
                extendField: '',
                tbField: '',
                fieldValue: '',
                index: indexs++
            })
            if (bm.bms2 == '入库') {
                post({
                    url: 'wms/WarehousetypeFieldextend/getFieldextendByInfoType',
                    data: {
                        "warehouseTypeName": searchData.whTypeName,
                        "stockInState": "1"
                    }
                }).then((res: any) => {
                    tjType.value = JSON.parse(JSON.stringify(res.data))
                })
            }
            if (bm.bms2 == '出库') {
                post({
                    url: 'wms/WarehousetypeFieldextend/getFieldextendByInfoType',
                    data: {
                        "warehouseTypeName": searchData.whTypeName,
                        "stockOutState": "1"
                    }
                }).then((res: any) => {
                    tjType.value = JSON.parse(JSON.stringify(res.data))
                })
            }
            if (bm.bms2 == '转仓') {
                post({
                    url: 'wms/WarehousetypeFieldextend/getFieldextendByInfoType',
                    data: {
                        "warehouseTypeName": searchData.whTypeName,
                        "transferInvoicesState": "1"
                    }
                }).then((res: any) => {
                    tjType.value = JSON.parse(JSON.stringify(res.data))
                })
            }
            if (bm.bms2 == '退货') {
                post({
                    url: 'wms/WarehousetypeFieldextend/getFieldextendByInfoType',
                    data: {
                        "warehouseTypeName": searchData.whTypeName,
                        "returnInvoicesState": "1"
                    }
                }).then((res: any) => {
                    tjType.value = JSON.parse(JSON.stringify(res.data))
                })
            }
        }
        const editHandlers = async (val: any) => {
            const res = await post({
                url: 'wms/warehousetypeDrop/getByLs',
                data: {
                    ls: val.ls
                }
            })
            if (res.code == 200) {
                dataListArray1.value = res.data.info
                tjIsDatasType.value = res.data.conditions
                visible.value = true
            }
        }
        const deletTj = (value: any) => {
            tjIsDatasType.value.forEach((item: any, index: any) => {
                if (value == item.index) {
                    tjIsDatasType.value.splice(index, 1)
                }
            })
        };

        const whService = new WHService();
        const companyList: any = whService.companyList;
        const whTypeList = whService.whTypeList
        const whList = ref<any[]>([])
        // 公司下拉框 改变
        const companyChange = () => {
            searchData.wh = "";
            whService.getWarhouseListByFirmId(searchData.firmId, searchData.whTypeName)
        };
        watch(() => whService.whList.value, (o, n) => {
            whList.value = whService.whList.value
        });
        const selectChange = () => {
            doRefresh();
            doRefreshs()
        };
        const fieldNameChange = () => {
            var fieldOb = pageData.fieldNameList.filter(function (o) {
                return dataForm.fieldId == o["id"];
            });
            if (fieldOb.length > 0 && fieldOb[0] != undefined) {
                dataForm["englishName"] = fieldOb[0]["englishName"];
                dataForm["valueType"] = fieldOb[0]["valueType"];
                dataForm["valueTypeNum"] = fieldOb[0]["valueTypeNum"];
            }

        };
        return {
            changeIds,
            fieldNameChange,
            selectChange,
            searchData,
            whList,
            whTypeList,
            companyList,
            companyChange,
            deletTj,
            editHandlers,
            tjIsDatasType,
            tjType,
            tjTj,
            bm,
            dataListArray1,
            changes1,
            handleCancel,
            handleOk,
            visible,
            cjxlks,
            tableColumns1,
            paginations,
            tabsChange,
            whStore,
            scroll,
            scrollbar,
            tablediv,
            deleteHandler,
            sideOk,
            formRef,
            dataForm,
            addHandler,
            selectedRowKeys,
            selectedRowKeys1,
            pagination,
            tableColumns,
            table,
            rowKey,
            pageData,
            queryData,
            editHandler,
            selectHandler,
            loading,
            handleSearch,
            focusSel,
            headerShow,
            table1,
            isIDs,
            PageSize,
            change1
        };
    },
};
</script>
<style scoped lang="less">
#isyou {
    margin: 10px;
}
</style>
